package spotGUI.utils;

import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import managers.conversationManager.ConversationManager;
import utils.UserData;



public class MessengerUserSelectionListener implements ListSelectionListener {

	@Override
	public void valueChanged(ListSelectionEvent e) {
		if (!e.getValueIsAdjusting()) {
			JList list = (JList)(e.getSource());
			UserData user = (UserData) list.getSelectedValue();
				if (user != null) {
					ConversationManager.getSharedInstance().getUserRequestsManager().requestUserDataAndContactUser(user);
					list.clearSelection();
				}
		}
	}

}
